#include<iostream>
#include<stdio.h>
#include<string.h>
#define maxn 105

// 蛇形数组

int a[maxn][maxn];
int n;

int main(){
    scanf("%d",&n);
    int sum=0,i=0,j=n-1;
    memset(a,0,sizeof(a));
    while(sum <= n*n){
        while(i+1<n && !a[i+1][j]) a[i++][j] = ++sum;
        while(j-1>=0 && !a[i][j-1]) a[i][j--] = ++sum;
        while(i-1>=0 && !a[i-1][j]) a[i--][j] = ++sum;
        while(j+1<n && !a[i][j+1]) a[i][j++] = ++sum;
    }
    for(i=0;i<n;i++){
        for(j=0;j<n;j++)
            printf("%3d",a[i][j]);
        printf("\n");
    }

    return 0;
}